<template>
	<view style="padding-bottom: 100rpx;">
		<u-navbar :title="'我的收藏'" title-bold title-color='#333333'>
			<view v-if="bj" slot="right" @click="bj=false" style="margin-right: 20rpx;
			font-size: 30rpx;
			font-family: Source Han Sans CN;
			font-weight: 600;
			color: #333333;
			opacity: 1;
			">编辑</view>
			<view v-else slot="right" @click="bj=true,quan=false" style="margin-right: 20rpx;
			font-size: 30rpx;
			font-family: Source Han Sans CN;
			font-weight: 600;
			color: #333333;
			opacity: 1;
			">完成</view>
		</u-navbar>
		<liuyuno-tabs pingfen :tabData="list" :activeIndex="current" @tabClick='tabClick' />
		<view class="body" style="padding: 0rpx 30rpx 30rpx 30rpx;">
			<myzb ref='child' @onnew='onnew' :bj='bj' :info='info' v-if="current==0" />
			<myjp :quan="quan" v-if="current==1" :info='info' />
			<myxl :quan="quan" v-if="current==2" :info='info' />
			<myzl :quan="quan" v-if="current==3" :info='info' />
			<myxxk :quan="quan" v-if="current==4" :info='info' />
			<mysp :quan="quan" v-if="current==5" :info='info' />
		</view>
		<view class="foot" v-if="!bj">
			<view class="foot_1">
				<image v-if="quan" @click="quan1(false)" src="@/static/img/dui.png" mode=""></image>
				<image v-else @click="quan1(true)" src="@/static/img/wxzh.png" mode=""></image>
				<text>全选</text>
			</view>
			<view class="foot_2">
				删除
			</view>
		</view>
	</view>
</template>
<script>
	import myzb from './components/myzb.vue'
	import myjp from './components/myjp.vue'
	import myxl from './components/myxl.vue'
	import myzl from './components/myzl.vue'
	import myxxk from './components/myxxk.vue'
	import mysp from './components/mysp.vue'
	export default {
		components: {
			myzb,
			myjp,
			myxl,
			myxxk,
			myzl,
			mysp
		},
		data() {
			return {
				listsc: [],
				quan: false,
				info: {},
				form: {
					type: 1, //类型:课程类型:1=直播,2=精品课程,3=线下课,4=系列课,5=专栏,6=商品
					page: 1,
				},
				bj: true,
				list: [{
						name: '直播',
					}, {
						name: '精品课程',
					}, {
						name: '线下课',
					}, {
						name: '系列课',
					}, {
						name: '专栏',
					}, {
						name: '商品',
					}

				],
				current: 0
			};
		},
		onLoad() {
			this.getinfo()
		},
		methods: {
			//全选操作
			quan1(a) {
				this.quan = a
				this.$refs.child.sing(a)
			},
			//选中数据
			onnew(a, b) {
				this.listsc = a
				this.quan = b
				console.log(this.listsc)
			},
			getinfo() {
				this.$api('usermsg/collect', this.form).then(res => {
					res.data.data.forEach(v => {
						v.check = false
					})
					this.info = res.data

				})
			},
			tabClick(a, b) {
				this.listsc = []
				this.current = b
				this.form.type = b * 1 + 1
				this.getinfo()
			},

		}
	}
</script>

<style lang="scss">
	.foot {
		padding: 0 20rpx 0 20rpx;
		width: 100%;
		height: 98rpx;
		position: fixed;
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: #FFFFFF;
		border-top: 1rpx solid #EFEFEF;
		;
		bottom: 0;

		.foot_2 {
			font-size: 30rpx;
			font-family: Source Han Sans CN;
			font-weight: 500;
			color: #703F00;
			opacity: 1;
			width: 200rpx;
			text-align: center;
			line-height: 68rpx;
			height: 68rpx;
			background: #FFD500;
			opacity: 1;
			border-radius: 44rpx;
		}

		.foot_1 {
			display: flex;
			align-items: center;

			text {
				display: inline-block;
				margin-left: 10rpx;
				font-size: 30rpx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				color: #333333;
				opacity: 1;
			}

			image {
				width: 40rpx;
				height: 40rpx;
			}
		}
	}
</style>
